﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;

namespace ConsoleDI.Example
{
	public class LoginClass
	{
		private readonly IGreeting _greeting;
        public LoginClass(IGreeting greeting)
        {
			_greeting = greeting;
        }
		public void Login(string userName)
		{
			if (userName == "张三")
			{
                //SayHello greeting = new SayHello();                
                //SayHi greeting = new SayHi();
				//greeting.Greeting(userName);

                _greeting.Greeting(userName);

                Console.WriteLine("user logged in");
			}
			else
			{
				Console.WriteLine("longin failure");
			}
		}
	}
}
